package com.xuecheng.content.controller;

import com.xuecheng.commons.model.dto.WorkBindDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.content.service.TeachplanWorkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author itheima
 */
@Slf4j
@RestController
public class TeachplanWorkController {

    @Autowired
    private TeachplanWorkService  teachplanWorkService;


    // 作业绑定
    @PostMapping("/teachplan/work/association")
    public ResponseResult association(@RequestBody WorkBindDto dto) {
        return teachplanWorkService.association(dto);
    }

    //  作业解绑
    @DeleteMapping("/teachplan/work/{teachplanWorkId}")
    public ResponseResult delete(@PathVariable("teachplanWorkId") Long teachplanWorkId,Long courseBaseId){
        return teachplanWorkService.delete(teachplanWorkId,courseBaseId);
    }

    //批阅详情-统计数据
    @GetMapping("/getWorkContentInfoByPubIdAndMediaType")
    public ResponseResult getInfo(Long courPubId) {
        //调用service
        return teachplanWorkService.getInfo(courPubId);
    }
}
